package me.aartikov.simplenavigationsample.slice;

import me.aartikov.alligator.Navigator;
import me.aartikov.alligator.helpers.MiFraction;
import me.aartikov.alligator.annotations.RegisterScreen;
import me.aartikov.simplenavigationsample.ResourceTable;
import me.aartikov.simplenavigationsample.SampleApplication;
import me.aartikov.simplenavigationsample.screens.ScreenC;
import me.aartikov.simplenavigationsample.screens.ScreenD;
import ohos.aafwk.content.Intent;
import ohos.agp.components.*;


@RegisterScreen(ScreenC.class)
public class MiFractionC extends MiFraction {
    private Navigator mNavigator = SampleApplication.getNavigator();

    @Override
    protected Component onComponentAttached(LayoutScatter scatter, ComponentContainer container, Intent intent) {
        Component content = scatter.parse(ResourceTable.Layout_mifraction_c, container, false);
        Button goForwardToDButton = (Button) content.findComponentById(ResourceTable.Id_go_forward_to_d_button);
        goForwardToDButton.setClickedListener(v -> mNavigator.goForward(new ScreenD("Message for D from C", getParentId(), getGouptag().toString())));
        return content;
    }

    @Override
    protected void setInitialFragmentIfRequired() {

    }
}
